package com.zxq.uart.result;

import lombok.Data;

@Data
public class ResultVO<T> {
    T data;
    private Boolean success;
    private Integer normal;
    private String code;
    private String message;
    private String msg;


    public ResultVO(T date) {
        this.setCode(CodeEnum.SUCCESS);
        this.setData(date);
    }
    public ResultVO(CodeEnum codeEnum) {
        this.setCode(codeEnum);
    }

    public void setCode(CodeEnum codeEnum){
        this.code = codeEnum.code();
        this.normal = codeEnum.normal();
        this.success = codeEnum.success();
        this.message = codeEnum.message();
        this.msg = codeEnum.message();
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }
}
